Source Code Viewer - Example 3 - ViewNewCountryAction

package name.matthewgreet.example3.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

import name.matthewgreet.example3.common.AbstractViewActionSupport;
import name.matthewgreet.example3.common.BrowserTabSession;
import name.matthewgreet.example3.common.ListCache;
import name.matthewgreet.example3.form.CountryForm;
import name.matthewgreet.example3.view.CountryDetailDisplay;
import name.matthewgreet.example3.vo.CountryDTO;


/**
 * Displays page to enter a new country. 
 */
@InterceptorRef("ViewStack")
@Results({
	@Result(name=ActionSupport.SUCCESS, location="/pages/NewCountry.jsp")
})
public class ViewNewCountryAction extends AbstractViewActionSupport {
	private static final long serialVersionUID = -7979376337555804889L;
	
	private CountryForm form;
	
	private CountryDetailDisplay display;
	
	
    @Action("/ViewNewCountry")
    @Override
    public String execute() throws Exception {
    	BrowserTabSession session;
    	ListCache<Integer,CountryDTO> listCache;
    	
    	session = getBrowserTabSession();
    	listCache = ViewCountryListAction.retrieveListCache(session);
    	if (form == null) {
        	form = new CountryForm();
    	}
    	display = new CountryDetailDisplay(listCache);
    	display.init();
		return SUCCESS;
    }

	public CountryForm getForm() {
		return form;
	}

	public CountryDetailDisplay getDisplay() {
		return display;
	}

}